<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"  
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:decorate template="/template/template.xhtml">
		<ui:define name="centro">			
			<h:form>				
				<p:panelGrid columns="2">		
					
						<f:facet name="header">Cadastro de Associação</f:facet>

						<h:outputText value="Entidade:" />
						<p:selectOneMenu value="#{associacaoBean.associacao.entidade}" required="true"
							panelStyle="width:150px" effect="fade" var="p" converter="entidadeConverter"
							styleClass="classe30" filter="true" filterMatchMode="contains"
							requiredMessage="Selecione uma Entidade">
							<f:selectItem itemLabel="Selecione uma Entidade" itemValue="" />
							<f:selectItems value="#{associacaoBean.listaEntidades}" var="entidade"
								itemLabel="#{entidade.nome}" itemValue="#{entidade}" />
							<p:column>  
		                		#{p.nome}  
		           			 </p:column>
						</p:selectOneMenu>


						<h:outputLabel for="data" value="Data: *" />
						<p:calendar id="data" value="#{associacaoBean.associacao.data}" required="true" 
							requiredMessage="O preenchimento da Data é obrigatório" label="Data" 
							effect="fadeIn" locale="pt" pattern="dd/MM/yyyy" />
						
			
						<f:facet name="footer">
							<p:commandButton value="Cancelar" immediate="true" ajax="false" icon="ui-icon-cancel" action="#{associacaoBean.listarAssociacoes}"
								style="margin:0" />
							<p:commandButton value="Salvar" ajax="false" icon="ui-icon-check" action="#{associacaoBean.alterarAssociacao}"
								style="margin:0" rendered="#{associacaoBean.alterar}" />
							<p:commandButton value="Salvar" ajax="false" icon="ui-icon-check" action="#{associacaoBean.incluirAssociacao}"
								style="margin:0" rendered="#{!associacaoBean.alterar}">
							</p:commandButton>
						</f:facet>			
				</p:panelGrid>
			</h:form>		
		</ui:define>
	</ui:decorate>
</html>